

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>Host Management &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="Service Management" href="../services/" />
    <link rel="prev" title="现有集群切换到 cephadm" href="../adoption/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Cephadm</a> &raquo;</li>
        
      <li>Host Management</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/cephadm/host-management.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Cephadm</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../compatibility/">Compatibility and Stability</a></li>
<li class="toctree-l2"><a class="reference internal" href="../install/">部署个全新的 Ceph 集群</a></li>
<li class="toctree-l2"><a class="reference internal" href="../adoption/">现有集群切换到 cephadm</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Host Management</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#adding-hosts">Adding Hosts</a></li>
<li class="toctree-l3"><a class="reference internal" href="#removing-hosts">Removing Hosts</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#offline-host-removal">Offline host removal</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#host-labels">Host labels</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#special-host-labels">Special host labels</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#maintenance-mode">Maintenance Mode</a></li>
<li class="toctree-l3"><a class="reference internal" href="#creating-many-hosts-at-once">Creating many hosts at once</a></li>
<li class="toctree-l3"><a class="reference internal" href="#setting-the-initial-crush-location-of-host">Setting the initial CRUSH location of host</a></li>
<li class="toctree-l3"><a class="reference internal" href="#ssh-configuration">SSH Configuration</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#default-behavior">Default behavior</a></li>
<li class="toctree-l4"><a class="reference internal" href="#configuring-a-different-ssh-user">Configuring a different SSH user</a></li>
<li class="toctree-l4"><a class="reference internal" href="#customizing-the-ssh-configuration">Customizing the SSH configuration</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#fully-qualified-domain-names-vs-bare-host-names">Fully qualified domain names vs bare host names</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../services/">Service Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../upgrade/">Ceph 的升级</a></li>
<li class="toctree-l2"><a class="reference internal" href="../operations/">Cephadm operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="../client-setup/">Client Setup</a></li>
<li class="toctree-l2"><a class="reference internal" href="../troubleshooting/">Troubleshooting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/cephadm/">Cephadm Feature Planning</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="host-management">
<span id="orchestrator-cli-host-management"></span><h1>Host Management<a class="headerlink" href="#host-management" title="Permalink to this headline">¶</a></h1>
<p>To list hosts associated with the cluster:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "# ";
}
</style><span class="prompt1">ceph orch host ls <span class="o">[</span>--format yaml<span class="o">]</span> <span class="o">[</span>--host-pattern &lt;name&gt;<span class="o">]</span> <span class="o">[</span>--label &lt;label&gt;<span class="o">]</span> <span class="o">[</span>--host-status &lt;status&gt;<span class="o">]</span></span>
</pre></div></div><p>where the optional arguments “host-pattern”, “label” and “host-status” are used for filtering.
“host-pattern” is a regex that will match against hostnames and will only return matching hosts
“label” will only return hosts with the given label
“host-status” will only return hosts with the given status (currently “offline” or “maintenance”)
Any combination of these filtering flags is valid. You may filter against name, label and/or status simultaneously</p>
<div class="section" id="adding-hosts">
<span id="cephadm-adding-hosts"></span><h2>Adding Hosts<a class="headerlink" href="#adding-hosts" title="Permalink to this headline">¶</a></h2>
<p>Hosts must have these <a class="reference internal" href="../install/#cephadm-host-requirements"><span class="std std-ref">准备事项</span></a> installed.
Hosts without all the necessary requirements will fail to be added to the cluster.</p>
<p>To add each new host to the cluster, perform two steps:</p>
<ol class="arabic">
<li><p>Install the cluster’s public SSH key in the new host’s root user’s <code class="docutils literal notranslate"><span class="pre">authorized_keys</span></code> file:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ssh-copy-id -f -i /etc/ceph/ceph.pub root@*&lt;new-host&gt;*</span>
</pre></div></div><p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ssh-copy-id -f -i /etc/ceph/ceph.pub root@host2</span>
<span class="prompt1">ssh-copy-id -f -i /etc/ceph/ceph.pub root@host3</span>
</pre></div></div></li>
<li><p>Tell Ceph that the new node is part of the cluster:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch host add *&lt;newhost&gt;* <span class="o">[</span>*&lt;ip&gt;*<span class="o">]</span> <span class="o">[</span>*&lt;label1&gt; ...*<span class="o">]</span></span>
</pre></div></div><p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch host add host2 <span class="m">10</span>.10.0.102</span>
<span class="prompt1">ceph orch host add host3 <span class="m">10</span>.10.0.103</span>
</pre></div></div><p>It is best to explicitly provide the host IP address.  If an IP is
not provided, then the host name will be immediately resolved via
DNS and that IP will be used.</p>
<p>One or more labels can also be included to immediately label the
new host.  For example, by default the <code class="docutils literal notranslate"><span class="pre">_admin</span></code> label will make
cephadm maintain a copy of the <code class="docutils literal notranslate"><span class="pre">ceph.conf</span></code> file and a
<code class="docutils literal notranslate"><span class="pre">client.admin</span></code> keyring file in <code class="docutils literal notranslate"><span class="pre">/etc/ceph</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch host add host4 <span class="m">10</span>.10.0.104 --labels _admin</span>
</pre></div></div></li>
</ol>
</div>
<div class="section" id="removing-hosts">
<span id="cephadm-removing-hosts"></span><h2>Removing Hosts<a class="headerlink" href="#removing-hosts" title="Permalink to this headline">¶</a></h2>
<p>A host can safely be removed from a the cluster once all daemons are removed from it.</p>
<p>To drain all daemons from a host do the following:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch host drain *&lt;host&gt;*</span>
</pre></div></div><p>The ‘_no_schedule’ label will be applied to the host. See <a class="reference internal" href="#cephadm-special-host-labels"><span class="std std-ref">Special host labels</span></a></p>
<p>All osds on the host will be scheduled to be removed. You can check osd removal progress with the following:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch osd rm status</span>
</pre></div></div><p>see <a class="reference internal" href="../services/osd/#cephadm-osd-removal"><span class="std std-ref">Remove an OSD</span></a> for more details about osd removal</p>
<p>You can check if there are no daemons left on the host with the following:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch ps &lt;host&gt;</span>
</pre></div></div><p>Once all daemons are removed you can remove the host with the following:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch host rm &lt;host&gt;</span>
</pre></div></div><div class="section" id="offline-host-removal">
<h3>Offline host removal<a class="headerlink" href="#offline-host-removal" title="Permalink to this headline">¶</a></h3>
<p>If a host is offline and can not be recovered it can still be removed from the cluster with the following:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch host rm &lt;host&gt; --offline --force</span>
</pre></div></div><p>This can potentially cause data loss as osds will be forcefully purged from the cluster by calling <code class="docutils literal notranslate"><span class="pre">osd</span> <span class="pre">purge-actual</span></code> for each osd.
Service specs that still contain this host should be manually updated.</p>
</div>
</div>
<div class="section" id="host-labels">
<span id="orchestrator-host-labels"></span><h2>Host labels<a class="headerlink" href="#host-labels" title="Permalink to this headline">¶</a></h2>
<p>The orchestrator supports assigning labels to hosts. Labels
are free form and have no particular meaning by itself and each host
can have multiple labels. They can be used to specify placement
of daemons. See <a class="reference internal" href="../services/#orch-placement-by-labels"><span class="std std-ref">Placement by labels</span></a></p>
<p>Labels can be added when adding a host with the <code class="docutils literal notranslate"><span class="pre">--labels</span></code> flag:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">orch</span> <span class="n">host</span> <span class="n">add</span> <span class="n">my_hostname</span> <span class="o">--</span><span class="n">labels</span><span class="o">=</span><span class="n">my_label1</span>
<span class="n">ceph</span> <span class="n">orch</span> <span class="n">host</span> <span class="n">add</span> <span class="n">my_hostname</span> <span class="o">--</span><span class="n">labels</span><span class="o">=</span><span class="n">my_label1</span><span class="p">,</span><span class="n">my_label2</span>
</pre></div>
</div>
<p>To add a label a existing host, run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">orch</span> <span class="n">host</span> <span class="n">label</span> <span class="n">add</span> <span class="n">my_hostname</span> <span class="n">my_label</span>
</pre></div>
</div>
<p>To remove a label, run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">orch</span> <span class="n">host</span> <span class="n">label</span> <span class="n">rm</span> <span class="n">my_hostname</span> <span class="n">my_label</span>
</pre></div>
</div>
<div class="section" id="special-host-labels">
<span id="cephadm-special-host-labels"></span><h3>Special host labels<a class="headerlink" href="#special-host-labels" title="Permalink to this headline">¶</a></h3>
<p>The following host labels have a special meaning to cephadm.  All start with <code class="docutils literal notranslate"><span class="pre">_</span></code>.</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">_no_schedule</span></code>: <em>Do not schedule or deploy daemons on this host</em>.</p>
<p>This label prevents cephadm from deploying daemons on this host.  If it is added to
an existing host that already contains Ceph daemons, it will cause cephadm to move
those daemons elsewhere (except OSDs, which are not removed automatically).</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">_no_autotune_memory</span></code>: <em>Do not autotune memory on this host</em>.</p>
<p>This label will prevent daemon memory from being tuned even when the
<code class="docutils literal notranslate"><span class="pre">osd_memory_target_autotune</span></code> or similar option is enabled for one or more daemons
on that host.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">_admin</span></code>: <em>Distribute client.admin and ceph.conf to this host</em>.</p>
<p>By default, an <code class="docutils literal notranslate"><span class="pre">_admin</span></code> label is applied to the first host in the cluster (where
bootstrap was originally run), and the <code class="docutils literal notranslate"><span class="pre">client.admin</span></code> key is set to be distributed
to that host via the <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">orch</span> <span class="pre">client-keyring</span> <span class="pre">...</span></code> function.  Adding this label
to additional hosts will normally cause cephadm to deploy config and keyring files
in <code class="docutils literal notranslate"><span class="pre">/etc/ceph</span></code>.</p>
</li>
</ul>
</div>
</div>
<div class="section" id="maintenance-mode">
<h2>Maintenance Mode<a class="headerlink" href="#maintenance-mode" title="Permalink to this headline">¶</a></h2>
<p>Place a host in and out of maintenance mode (stops all Ceph daemons on host):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">orch</span> <span class="n">host</span> <span class="n">maintenance</span> <span class="n">enter</span> <span class="o">&lt;</span><span class="n">hostname</span><span class="o">&gt;</span> <span class="p">[</span><span class="o">--</span><span class="n">force</span><span class="p">]</span>
<span class="n">ceph</span> <span class="n">orch</span> <span class="n">host</span> <span class="n">maintenance</span> <span class="n">exit</span> <span class="o">&lt;</span><span class="n">hostname</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>Where the force flag when entering maintenance allows the user to bypass warnings (but not alerts)</p>
<p>See also <a class="reference internal" href="#cephadm-fqdn"><span class="std std-ref">Fully qualified domain names vs bare host names</span></a></p>
</div>
<div class="section" id="creating-many-hosts-at-once">
<h2>Creating many hosts at once<a class="headerlink" href="#creating-many-hosts-at-once" title="Permalink to this headline">¶</a></h2>
<p>Many hosts can be added at once using
<code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">orch</span> <span class="pre">apply</span> <span class="pre">-i</span></code> by submitting a multi-document YAML file:</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">service_type</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">host</span>
<span class="nt">hostname</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">node-00</span>
<span class="nt">addr</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">192.168.0.10</span>
<span class="nt">labels</span><span class="p">:</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">example1</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">example2</span>
<span class="nn">---</span>
<span class="nt">service_type</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">host</span>
<span class="nt">hostname</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">node-01</span>
<span class="nt">addr</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">192.168.0.11</span>
<span class="nt">labels</span><span class="p">:</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">grafana</span>
<span class="nn">---</span>
<span class="nt">service_type</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">host</span>
<span class="nt">hostname</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">node-02</span>
<span class="nt">addr</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">192.168.0.12</span>
</pre></div>
</div>
<p>This can be combined with service specifications (below) to create a cluster spec
file to deploy a whole cluster in one command.  see <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">bootstrap</span> <span class="pre">--apply-spec</span></code>
also to do this during bootstrap. Cluster SSH Keys must be copied to hosts prior to adding them.</p>
</div>
<div class="section" id="setting-the-initial-crush-location-of-host">
<h2>Setting the initial CRUSH location of host<a class="headerlink" href="#setting-the-initial-crush-location-of-host" title="Permalink to this headline">¶</a></h2>
<p>Hosts can contain a <code class="docutils literal notranslate"><span class="pre">location</span></code> identifier which will instruct cephadm to
create a new CRUSH host located in the specified hierarchy.</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">service_type</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">host</span>
<span class="nt">hostname</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">node-00</span>
<span class="nt">addr</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">192.168.0.10</span>
<span class="nt">location</span><span class="p">:</span>
  <span class="nt">rack</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">rack1</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The <code class="docutils literal notranslate"><span class="pre">location</span></code> attribute will be only affect the initial CRUSH location. Subsequent
changes of the <code class="docutils literal notranslate"><span class="pre">location</span></code> property will be ignored. Also, removing a host will no remove
any CRUSH buckets.</p>
</div>
<p>See also <a class="reference internal" href="../../rados/operations/crush-map/#crush-map-default-types"><span class="std std-ref">类型和桶</span></a>.</p>
</div>
<div class="section" id="ssh-configuration">
<h2>SSH Configuration<a class="headerlink" href="#ssh-configuration" title="Permalink to this headline">¶</a></h2>
<p>Cephadm uses SSH to connect to remote hosts.  SSH uses a key to authenticate
with those hosts in a secure way.</p>
<div class="section" id="default-behavior">
<h3>Default behavior<a class="headerlink" href="#default-behavior" title="Permalink to this headline">¶</a></h3>
<p>Cephadm stores an SSH key in the monitor that is used to
connect to remote hosts.  When the cluster is bootstrapped, this SSH
key is generated automatically and no additional configuration
is necessary.</p>
<p>A <em>new</em> SSH key can be generated with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">cephadm</span> <span class="n">generate</span><span class="o">-</span><span class="n">key</span>
</pre></div>
</div>
<p>The public portion of the SSH key can be retrieved with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">cephadm</span> <span class="n">get</span><span class="o">-</span><span class="n">pub</span><span class="o">-</span><span class="n">key</span>
</pre></div>
</div>
<p>The currently stored SSH key can be deleted with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">cephadm</span> <span class="n">clear</span><span class="o">-</span><span class="n">key</span>
</pre></div>
</div>
<p>You can make use of an existing key by directly importing it with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">config</span><span class="o">-</span><span class="n">key</span> <span class="nb">set</span> <span class="n">mgr</span><span class="o">/</span><span class="n">cephadm</span><span class="o">/</span><span class="n">ssh_identity_key</span> <span class="o">-</span><span class="n">i</span> <span class="o">&lt;</span><span class="n">key</span><span class="o">&gt;</span>
<span class="n">ceph</span> <span class="n">config</span><span class="o">-</span><span class="n">key</span> <span class="nb">set</span> <span class="n">mgr</span><span class="o">/</span><span class="n">cephadm</span><span class="o">/</span><span class="n">ssh_identity_pub</span> <span class="o">-</span><span class="n">i</span> <span class="o">&lt;</span><span class="n">pub</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>You will then need to restart the mgr daemon to reload the configuration with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">mgr</span> <span class="n">fail</span>
</pre></div>
</div>
</div>
<div class="section" id="configuring-a-different-ssh-user">
<span id="cephadm-ssh-user"></span><h3>Configuring a different SSH user<a class="headerlink" href="#configuring-a-different-ssh-user" title="Permalink to this headline">¶</a></h3>
<p>Cephadm must be able to log into all the Ceph cluster nodes as an user
that has enough privileges to download container images, start containers
and execute commands without prompting for a password. If you do not want
to use the “root” user (default option in cephadm), you must provide
cephadm the name of the user that is going to be used to perform all the
cephadm operations. Use the command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">cephadm</span> <span class="nb">set</span><span class="o">-</span><span class="n">user</span> <span class="o">&lt;</span><span class="n">user</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>Prior to running this the cluster ssh key needs to be added to this users
authorized_keys file and non-root users must have passwordless sudo access.</p>
</div>
<div class="section" id="customizing-the-ssh-configuration">
<h3>Customizing the SSH configuration<a class="headerlink" href="#customizing-the-ssh-configuration" title="Permalink to this headline">¶</a></h3>
<p>Cephadm generates an appropriate <code class="docutils literal notranslate"><span class="pre">ssh_config</span></code> file that is
used for connecting to remote hosts.  This configuration looks
something like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Host</span> <span class="o">*</span>
<span class="n">User</span> <span class="n">root</span>
<span class="n">StrictHostKeyChecking</span> <span class="n">no</span>
<span class="n">UserKnownHostsFile</span> <span class="o">/</span><span class="n">dev</span><span class="o">/</span><span class="n">null</span>
</pre></div>
</div>
<p>There are two ways to customize this configuration for your environment:</p>
<ol class="arabic">
<li><p>Import a customized configuration file that will be stored
by the monitor with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">cephadm</span> <span class="nb">set</span><span class="o">-</span><span class="n">ssh</span><span class="o">-</span><span class="n">config</span> <span class="o">-</span><span class="n">i</span> <span class="o">&lt;</span><span class="n">ssh_config_file</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>To remove a customized SSH config and revert back to the default behavior:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">cephadm</span> <span class="n">clear</span><span class="o">-</span><span class="n">ssh</span><span class="o">-</span><span class="n">config</span>
</pre></div>
</div>
</li>
<li><p>You can configure a file location for the SSH configuration file with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">config</span> <span class="nb">set</span> <span class="n">mgr</span> <span class="n">mgr</span><span class="o">/</span><span class="n">cephadm</span><span class="o">/</span><span class="n">ssh_config_file</span> <span class="o">&lt;</span><span class="n">path</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>We do <em>not recommend</em> this approach.  The path name must be
visible to <em>any</em> mgr daemon, and cephadm runs all daemons as
containers. That means that the file either need to be placed
inside a customized container image for your deployment, or
manually distributed to the mgr data directory
(<code class="docutils literal notranslate"><span class="pre">/var/lib/ceph/&lt;cluster-fsid&gt;/mgr.&lt;id&gt;</span></code> on the host, visible at
<code class="docutils literal notranslate"><span class="pre">/var/lib/ceph/mgr/ceph-&lt;id&gt;</span></code> from inside the container).</p>
</li>
</ol>
</div>
</div>
<div class="section" id="fully-qualified-domain-names-vs-bare-host-names">
<span id="cephadm-fqdn"></span><h2>Fully qualified domain names vs bare host names<a class="headerlink" href="#fully-qualified-domain-names-vs-bare-host-names" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>cephadm demands that the name of the host given via <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">orch</span> <span class="pre">host</span> <span class="pre">add</span></code>
equals the output of <code class="docutils literal notranslate"><span class="pre">hostname</span></code> on remote hosts.</p>
</div>
<p>Otherwise cephadm can’t be sure that names returned by
<code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">*</span> <span class="pre">metadata</span></code> match the hosts known to cephadm. This might result
in a <a class="reference internal" href="../operations/#cephadm-stray-host"><span class="std std-ref">CEPHADM_STRAY_HOST</span></a> warning.</p>
<p>When configuring new hosts, there are two <strong>valid</strong> ways to set the
<code class="docutils literal notranslate"><span class="pre">hostname</span></code> of a host:</p>
<ol class="arabic simple">
<li><p>Using the bare host name. In this case:</p></li>
</ol>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">hostname</span></code> returns the bare host name.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">hostname</span> <span class="pre">-f</span></code> returns the FQDN.</p></li>
</ul>
<ol class="arabic simple" start="2">
<li><p>Using the fully qualified domain name as the host name. In this case:</p></li>
</ol>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">hostname</span></code> returns the FQDN</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">hostname</span> <span class="pre">-s</span></code> return the bare host name</p></li>
</ul>
<p>Note that <code class="docutils literal notranslate"><span class="pre">man</span> <span class="pre">hostname</span></code> recommends <code class="docutils literal notranslate"><span class="pre">hostname</span></code> to return the bare
host name:</p>
<blockquote>
<div><p>The FQDN (Fully Qualified Domain Name) of the system is the
name that the resolver(3) returns for the host name, such as,
ursula.example.com. It is usually the hostname followed by the DNS
domain name (the part after the first dot). You can check the FQDN
using <code class="docutils literal notranslate"><span class="pre">hostname</span> <span class="pre">--fqdn</span></code> or the domain name using <code class="docutils literal notranslate"><span class="pre">dnsdomainname</span></code>.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>You cannot change the FQDN with hostname or dnsdomainname.

The recommended method of setting the FQDN is to make the hostname
be an alias for the fully qualified name using /etc/hosts, DNS, or
NIS. For example, if the hostname was &quot;ursula&quot;, one might have
a line in /etc/hosts which reads

       127.0.1.1    ursula.example.com ursula
</pre></div>
</div>
</div></blockquote>
<p>Which means, <code class="docutils literal notranslate"><span class="pre">man</span> <span class="pre">hostname</span></code> recommends <code class="docutils literal notranslate"><span class="pre">hostname</span></code> to return the bare
host name. This in turn means that Ceph will return the bare host names
when executing <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">*</span> <span class="pre">metadata</span></code>. This in turn means cephadm also
requires the bare host name when adding a host to the cluster:
<code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">orch</span> <span class="pre">host</span> <span class="pre">add</span> <span class="pre">&lt;bare-name&gt;</span></code>.</p>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../services/" class="btn btn-neutral float-right" title="Service Management" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../adoption/" class="btn btn-neutral float-left" title="现有集群切换到 cephadm" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>